package com.zlm.user.emp.controller;

import com.zlm.common.base.BaseController;
import com.zlm.common.constants.CodeConstants;
import com.zlm.common.constants.FileConstants;
import com.zlm.common.constants.NumberConstants;
import com.zlm.common.dto.JsonResultDto;
import com.zlm.common.entity.SysEmpAttDO;
import com.zlm.common.util.DateTimeUtils;
import com.zlm.user.emp.service.SysEmpAttService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.ArrayList;
import java.util.List;

/**
 * @Author: duyufu
 * @Date: 2019/6/25 12:45
 */
@RequestMapping("/sysEmpAtt")
@RestController
public class SysEmpAttController extends BaseController {

    @Autowired
    private SysEmpAttService sysEmpAttService;

    @GetMapping("/saveHealthReport")
    public JsonResultDto saveHealthReport(Integer empId, String[] urlList) {
        try {
            sysEmpAttService.saveHealthReport(empId,urlList);
            return success();
        } catch (Exception e) {
            e.printStackTrace();
            return fail(e.getMessage());
        }
    }

    @GetMapping("/deleteHealthReport")
    public JsonResultDto deleteHealthReport(Integer empId,Integer attId) {
        try {
            sysEmpAttService.deleteHealthReport(empId,attId);
            return success();
        } catch (Exception e) {
            e.printStackTrace();
            return fail(e.getMessage());
        }
    }

    @GetMapping("/queryHealthReport")
    public JsonResultDto queryHealthReport(Integer empId) {
        try {
            List<SysEmpAttDO> empAttList = sysEmpAttService.queryHealthReport(empId);
            return success(empAttList);
        } catch (Exception e) {
            e.printStackTrace();
            return fail(e.getMessage());
        }
    }

}
